/*
 * SpeedoDyno - Speedometer and dynamometer application for Android 
 * Copyright 2013 Guilhem VALENTIN
 * 
 * This file is part of SpeedoDyno
 * 
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 * 
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
 * GNU General Public License for more details.
 * 
 * You should have received a copy of the GNU General Public License
 * along with SpeedoDyno. If not, see <http://www.gnu.org/licenses/>.
 */
package com.gvalentin.speedodyno.util;

import java.util.Iterator;
import java.util.ListIterator;

/**
 * Rolling list of values
 * @author guilhem
 */
public interface RollingList<T> extends Iterable<T> {

	/**
	 * Add item at last position in the list
	 * @param item
	 */
	boolean add(T item);
	
	/**
	 * Gets current size of the list
	 * @return
	 */
	int size();
	
	/**
	 * Indicate whether list is empty
	 * @return
	 */
	boolean isEmpty();
	
    /**
     * Retrieves the item at the specified index in this list.
     * @param index The index to look up
     * @return The item at the specified index
     */
    T get(final int index);
    
	/**
     * Retrieves the last item in this list.
     * @param index The index to look up
     * @return The item at the last index
	 */
	T getLast();
	
	/**
	 * Get iterator on list
	 */
	Iterator<T> iterator();
	
	/**
	 * Get list iterator on list
	 */
	ListIterator<T> listIterator();
}
